﻿#region

using AutoMapper;
using HouseHoldBudget.Core.Entities.Budgets;
using HouseHoldBudget.Core.Entities.Expenses;
using HouseHoldBudget.Core.Entities.Incomes;
using HouseHoldBudget.Core.Entities.User;
using HouseHoldBudget.Models.Budgets;
using HouseHoldBudget.Models.Expenses;
using HouseHoldBudget.Models.Incomes;
using HouseHoldBudget.Models.User;

#endregion

namespace HouseHoldBudget.Infrastructure
{
    public static class MappingExtensions
    {
        #region Budget

        public static Budget ToEntity(this BudgetModel model)
        {
            return Mapper.Map<BudgetModel, Budget>(model);
        }

        public static Budget ToEntity(this BudgetModel model, Budget destination)
        {
            return Mapper.Map(model, destination);
        }

        public static BudgetModel ToModel(this Budget entity)
        {
            return Mapper.Map<Budget, BudgetModel>(entity);
        }

        #endregion

        #region BudgetResult

        public static Budget ToEntity(this BudgetResultModel model)
        {
            return Mapper.Map<BudgetResultModel, Budget>(model);
        }

        public static Budget ToEntity(this BudgetResultModel model, Budget destination)
        {
            return Mapper.Map(model, destination);
        }

        public static BudgetResultModel ToModel2(this Budget entity)
        {
            return Mapper.Map<Budget, BudgetResultModel>(entity);
        }

        #endregion

        #region Budget Category

        public static BudgetCategory ToEntity(this BudgetCategoryModel model)
        {
            return Mapper.Map<BudgetCategoryModel, BudgetCategory>(model);
        }

        public static BudgetCategory ToEntity(this BudgetCategoryModel model, BudgetCategory destination)
        {
            return Mapper.Map(model, destination);
        }

        public static BudgetCategoryModel ToModel(this BudgetCategory entity)
        {
            return Mapper.Map<BudgetCategory, BudgetCategoryModel>(entity);
        }

        #endregion

        #region Fixed Income

        public static FixedIncome ToEntity(this FixedIncomeModel model)
        {
            return Mapper.Map<FixedIncomeModel, FixedIncome>(model);
        }

        public static FixedIncome ToEntity(this FixedIncomeModel model, FixedIncome destination)
        {
            return Mapper.Map(model, destination);
        }

        public static FixedIncomeModel ToModel(this FixedIncome entity)
        {
            return Mapper.Map<FixedIncome, FixedIncomeModel>(entity);
        }

        #endregion

        #region Occasional Income

        public static OccasionalIncome ToEntity(this OccasionalIncomeModel model)
        {
            return Mapper.Map<OccasionalIncomeModel, OccasionalIncome>(model);
        }

        public static OccasionalIncome ToEntity(this OccasionalIncomeModel model, OccasionalIncome destination)
        {
            return Mapper.Map(model, destination);
        }

        public static OccasionalIncomeModel ToModel(this OccasionalIncome entity)
        {
            return Mapper.Map<OccasionalIncome, OccasionalIncomeModel>(entity);
        }

        #endregion

        #region Expense

        public static Expense ToEntity(this ExpenseModel model)
        {
            return Mapper.Map<ExpenseModel, Expense>(model);
        }

        public static Expense ToEntity(this ExpenseModel model, Expense destination)
        {
            return Mapper.Map(model, destination);
        }

        public static ExpenseModel ToModel(this Expense entity)
        {
            return Mapper.Map<Expense, ExpenseModel>(entity);
        }

        #endregion

        #region BudgetActors

        public static BudgetUser ToEntity(this BudgetUserModel model)
        {
            return Mapper.Map<BudgetUserModel, BudgetUser>(model);
        }

        public static BudgetUser ToEntity(this BudgetUserModel model, BudgetUser destination)
        {
            return Mapper.Map(model, destination);
        }

        public static BudgetUserModel ToModel(this BudgetUser entity)
        {
            return Mapper.Map<BudgetUser, BudgetUserModel>(entity);
        }

        #endregion

        #region BudgetType

        public static ExpenseType ToEntity(this ExpenseTypesModel model)
        {
            return Mapper.Map<ExpenseTypesModel, ExpenseType>(model);
        }

        public static ExpenseType ToEntity(this ExpenseTypesModel model, ExpenseType destination)
        {
            return Mapper.Map(model, destination);
        }

        public static ExpenseTypesModel ToModel(this ExpenseType entity)
        {
            return Mapper.Map<ExpenseType, ExpenseTypesModel>(entity);
        }

        #endregion

    }
}